import {
    ShareDialog
} from 'react-native-fbsdk';

export const link = (url: string, desc: string) => (
    new Promise((resolve) => {
        const _para: any = {
            contentUrl: url,
            contentType: `link`,
            quote: desc
        }
        ShareDialog.canShow(_para).
        then(_can => {
            if (!_can) resolve(false);
            return ShareDialog.show(_para)
        }).then((res) => {
            const {
                isCancelled
            } = res;
            resolve(!isCancelled)
        }).catch(() => (
            resolve(false)
        ))
    })
)